package wechat.handler.request.base;

import com.alibaba.fastjson.JSONObject;

import wechat.handler.util.http.HttpClientUtil;

public class BaseMenu extends BaseRequest {
	protected static final String Click = "click";
	protected static final String View = "view";
	protected static final String Scancode_push = "scancode_push";
	protected static final String Scancode_waitmsg = "scancode_waitmsg";
	
	protected boolean createMenu(String param) throws Exception {
		String url = super.api_menu_create.replace("ACCESS_TOKEN", getAccessToken());
		String result = HttpClientUtil.post(url, param);
		
		JSONObject jsonResult = JSONObject.parseObject(result);
		checkResult(jsonResult);
			
		return true;
	}
	
	protected boolean createMenu(String appid ,String param) throws Exception {
		String url = super.api_menu_create.replace("ACCESS_TOKEN", getAccessToken(appid));
		String result = HttpClientUtil.post(url, param);
		
		JSONObject jsonResult = JSONObject.parseObject(result);
		checkResult(jsonResult);
			
		return true;
	}
}
